package org.example.encoding;

import java.lang.reflect.Proxy;

/**
 * @Author :tuhan
 * @Date : 2021/3/23 17:54
 **/
public class DynamicTest {

    public static void main(String[] args){


       /* Subject  subjectProxy= (Subject) Proxy.newProxyInstance(RealSubject.class.getClassLoader(),
                RealSubject.class.getInterfaces(),new Dynamic(new RealSubject()));

        subjectProxy.request();*/


        RealSubject realSubject = new RealSubject();
        Dynamic dynamic = new Dynamic(realSubject);
        Subject subjectProxy1 = (Subject) Proxy.newProxyInstance(
                realSubject.getClass().getClassLoader(),realSubject.getClass().getInterfaces(),dynamic);

        subjectProxy1.request();


    }
}
